package gof.com.yew.observer;

import java.util.ArrayList;
import java.util.List;

public abstract class Subject { 
	
	protected List<Observer> lists = new ArrayList<>();
	
	public void register(Observer o) {
		 lists.add(o);
	}
	
	public void removeObserver(Observer o) {
		lists.remove(o);
	}
	
	public void notifyObservers() {
		for(Observer o: lists ) {
			o.update(this);
		}
	}
	
	public abstract void setState(int num);
	
}
